<template>
  <div>
    <el-header height="70px" class="sub-header">
      <div class="sub-header-info">
        <div class="sub-title-info-img">
          <img v-if="!userInfo.headImg" src="../../assets/img/user.jpg" alt />
          <img v-if="userInfo.headImg" :src="userInfo.headImg" alt />
        </div>
        <div class="area-info">
          <p class="area-first-p">{{userInfo.communityName}}</p>
          <p class="area-sec-p">
            {{userInfo.provinceName}}{{userInfo.cityName}}{{userInfo.districtName}}{{userInfo.address}}</p>
        </div>
      </div>
    </el-header>
  </div>
</template>

<script>
import { setItem, getItem } from "../../tools/common";
export default {
  data() {
    return {
      userInfo: {}
    };
  },
  methods: {
    fetchData() {
      this.userInfo = getItem("info");
    }
  },
  mounted() {
    this.fetchData();
  }
};
</script>

<style scoped>
.el-menu {
  height: 100%;
}
.sub-header {
  padding: 0;
  display: flex;
  background-color: #fff;
}
.sub-header-info {
  margin-left: 30px;
  display: flex;
  align-items: center;
}
.el-header {
  padding: 0;
}
.sub-title-info-img img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}
.area-info {
  margin-left: 10px;
}
.area-first-p {
  font-size: 18px;
  margin-bottom: 8px;
}
.area-sec-p {
  font-size: 14px;
}
</style>


